<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <title>1</title>
        <!-- 引入Vue -->
        <script type="text/javascript" src="../js/vue.js"></script>
    </head>
    <body>
        <!-- 准备好一个容器-->
        <div id="demo">
            <h1>人员信息</h1>
            <ul>
                <li>姓名:{{name}}</li>
                <li>年龄:{{age}}</li>
                <li>爱好:{{hobby}}</li>
            </ul>
            <button @click="changeName">改名</button>
			<button @click="changeAge">改年龄</button>
			<button @click="changeFirstHobby">改第1个爱好</button>
        </div>
    </body>

    <script type="text/javascript">
        //阻止 vue 在启动时生成生产提示。
        Vue.config.productionTip = false
        new Vue({
            el:'#demo',
            data:{
                name:'小张',
                age:18,
                hobby:['听歌','画画','看书'],

            },
            methods: {
             changeName(){
                 this.name='小王'
             },
             changeAge(){
                 this.age=20
             },
             changeFirstHobby(){
                 this.hobby.splice(0,1,'滑板')
             }   
            }
        })
    </script>
</html>